<?php
namespace common\core;
use Yii;
use common\core\CryptAES;
/**
 * 公共使用类
 * Enter description here ...
 * @author Administrator
 *
 */
class HoComm
{
	/*获取菜单*/
    public static function getMenu(){
        /*确定菜单组
        */
//        $role_id
        $role_name=Yii::$app->session['user']['role'];
        $models=\Yii::$app->db->createCommand("select ai.name from {{%auth_item}} ai, {{%auth_item_child}} aic where aic.child =ai.name and  ai.type=2 and ai.level=1 and aic.parent='".$role_name."'")->queryColumn();
        $arr=array();

//        $models=\Yii::$app->db->createCommand("select name from {{%auth_item}} where type=2 and level=1")->queryColumn();
        foreach($models as $name){
            $childs=\Yii::$app->db->createCommand("select aic1.child from {{%auth_item_child}} aic1,{{%auth_item_child}} aic2  where aic1.child=aic2.child and  aic2.parent='".$role_name."' and  aic1.parent='".$name."'")->queryColumn();
//                $childs=\Yii::$app->db->createCommand("select child from {{%auth_item_child}} where parent='".$name."'")->queryColumn();
                if(!empty($childs)){
                    $arr[$name]=$childs;
                }else{
                    $arr[$name]="";

                }
        }
        return $arr;
        //return $authManager->getPermissions();
    }
    public  static function  getCoin($key){
        if ($key != null) {
            $icon = \Yii::$app->db->createCommand("SELECT icon FROM {{%auth_item}} WHERE name = '" . $key . "'")->queryScalar();
            return $icon;
        }
    }
    public static function getActive($key){
        $con=Yii::$app->controller->id;
        $act=Yii::$app->controller->action->id;
        $str=$con."/".$act;
        $data= Yii::$app->db->createCommand("select p.name,p.level from lc_auth_item p,lc_auth_item_child c where c.parent=p.name and child='".$str."' and p.type=2")->queryOne();
        if($data['name']==$key){
            return "active";
        }else{
            return "";
        }

    }
    /**
     * 获取菜单名称
     *
     */
    public static function getDescription($name)
    {
        if ($name != null) {
           $description = \Yii::$app->db->createCommand("SELECT description FROM {{%auth_item}} WHERE name = '" . $name . "'")->queryScalar();
            return $description;
        }
    }
    /*获取用户层级或者角色层级*/
    public static function  getLevel($index=0){
//        $arr = ['1'=>'集团', '2'=>'大区', '3'=>'城市', '4'=>'楼盘'];
        $arr = ['3'=>'集团','1'=>'区域小组', '2'=>'楼盘'];
        if ($index) {
            return $arr[$index];
        }
        return $arr;
    }
    /*后台用户状态*/
    public static function  getUserState($index=0){
        $arr = ['1'=>'正常', '2'=>'锁定','3'=>'待审核','4'=>'审核不通'];
        if ($index) {
            return $arr[$index];
        }
        return $arr;
    }
    /*用户购房状态*/
    public static function getCustState($index=0){
        $arr = ['1'=>'问询', '2'=>'看房','3'=>'预约','4'=>'认购','5'=>'签约','6'=>"丢失",'8'=>'小订','9'=>'推荐成功'];
        if ($index) {
            return $arr[$index];
        }
        return $arr;
    }
    /*意向面积*/
    public static function getCustintentionarea($index=0){
        $arr = ['1'=>'0-90', '2'=>'90-130','3'=>'130以上'];
        if ($index) {
            return $arr[$index];
        }
        return $arr;
    }
    /*意向均价*/
    public static function getCustintentionprice($index=0){
        $arr = ['1'=>'0-7000', '2'=>'7000-9000','3'=>'9000-15000','4'=>'15000-25000','5'=>'25000以上'];

        if ($index) {
            return $arr[$index];
        }
        return $arr;
    }
    /*意向户型*/
    public static function getCustintentionunit($index=0){
        $arr = ['1'=>'两室', '2'=>'三室','3'=>'四室','4'=>'酒店式公寓','5'=>'排屋','6'=>'别墅'];
        if ($index) {
            return $arr[$index];
        }
        return $arr;
    }
   public  static  function  getVisittype($index=0){
       $arr = ['1'=>'已约见客户面聊', '2'=>'客户已上门看房','3'=>'已上门拜访','4'=>'已电话回访','5'=>'其他'];
       if ($index) {
           return $arr[$index];
       }
       return $arr;
   }
    public static function  verifyfile($index=''){
        if($index==""||$index==null){
            return false;
        }else{
            return true;
        }
    }

    /**
     * 获取区，市，楼盘，联动参数
     * $level  ['1'=>'集团', '2'=>'大区', '3'=>'城市', '4'=>'楼盘'];,$id 父级id
     */
    public static function getNextarea($level,$id)
    {
        if($level==1){
            $models = \Yii::$app->db->createCommand("SELECT city_id AS id, city_name AS name FROM {{%city}}")->queryAll();
        }elseif($level==2){
            $models = \Yii::$app->db->createCommand("SELECT id, house_name AS  name FROM {{%house}} WHERE city_id = ". $id)->queryAll();
        }else{
            $models = "";
        }
//        switch($level)
//        {
//            case 4:
//                $models = \Yii::$app->db->createCommand("SELECT id, house_name AS  name FROM {{%house}} WHERE city_id = " . $id)->queryAll();
//                break;
//            case 2:
//                $models = \Yii::$app->db->createCommand("SELECT area_id AS id,area_name AS name FROM {{%area}} ")->queryAll();
//                break;
//            case 3:
//                $models = \Yii::$app->db->createCommand("SELECT city_id AS id, city_name AS name FROM {{%city}} WHERE area_id = " . $id)->queryAll();
//                break;
//            default :
//                $models = "";
//        }
        return $models;
    }

    /*
     * 验证权限
     *
     * */
    public static function checkAccess($name){
        if($name){
            $item=Yii::$app->db->createCommand("select * from {{%auth_item}} where name='".$name."'")->queryOne();
            if(empty($item)){
                return true;
            }else{
                $role_name=Yii::$app->session['user']['role'];
                $model=Yii::$app->db->createCommand("select * from lc_auth_item_child where parent='".$role_name."' and child='".$name."'")->queryOne();
                if(empty($model)){
                    return false;
                }else{
                    return true;
                }
            }
        }
    }
    public  static function  getNWExID(){
        $url = "http://121.199.65.244:8090/newseeserver.aspx";
        $head  = array(
            'NWVersion'=>'01',
            'NWCode'=>1,
            'NWGUID'=>'2010072115220907818261',
            'NWExID'=>'',
        );
        $data = array(
            'Account'=>'server',
            'PassWord'=>'server8898',
            'Mac'=>'218.75.31.30'
        );
        $Request = array('Head'=>$head,'Data'=>$data);
        $post_json = json_encode(array('Request'=>$Request));
        $keyStr = '01234567890123456789012345678901';
        $aes = new CryptAES();
        $aes->set_key($keyStr);
        $aes->require_pkcs5();
        $post_jsonx = $aes->encrypt($post_json);
        $res = HoComm::request_post($url, $post_jsonx);
        $decString = $aes->decrypt($res);
        $result=json_decode($decString,true);
        $NWExID=$result['Response']['Head']['NWExID'];
        return $NWExID;
    }
    public static function  getInterfaceinfo($NWExID,$NWCode,$data){
        $url = "http://121.199.65.244:8090/newseeserver.aspx";
        $head  = array(
            'NWVersion'=>'01',
            'NWCode'=>$NWCode,
            'NWGUID'=>'2010072115220907818261',
            'NWExID'=>$NWExID,
        );
        $Request = array('Head'=>$head,'Data'=>$data);
        $post_json = json_encode(array('Request'=>$Request));
        $keyStr = '01234567890123456789012345678901';
        $aes = new CryptAES();
        $aes->set_key($keyStr);
        $aes->require_pkcs5();
        $post_jsonx = $aes->encrypt($post_json);
        $res =HoComm::request_post($url, $post_jsonx);
        $decString = $aes->decrypt($res);
        $result=json_decode($decString,true);
        return $result;
    }
    public  static function request_post($url = '', $param = '') {
        if (empty($url) || empty($param)) {
            return false;
            exit;
        }
        $postUrl = $url;
        $curlPost = $param;
        $ch = curl_init(); //初始化curl
        curl_setopt($ch, CURLOPT_URL, $postUrl); //抓取指定网页
        curl_setopt($ch, CURLOPT_HEADER, 0); //设置header
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上
        curl_setopt($ch, CURLOPT_POST, 1); //post提交方式
        curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
        $data = curl_exec($ch); //运行curl
        curl_close($ch);
        return $data;
    }
    /*佣金状态*/
    public static function getRewardState($index = 0)
    {
        $model = ['1' => '待审核', '2' => '待发放', '3' => '部分发放', '4' => '已发放','5'=>'驳回'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }
    /*奖励状态*/
    public static function getOrderRewardState($index = 0)
    {
        $model = ['3' => '待审核', '1' => '未寄送', '2' => '驳回', '10' => '已寄送'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }
    /* 奖励类型 */
    public static function getOrderRewardType($index = 0)
    {
        $model = ['1' => '到访奖励', '2' => '认筹奖励', '3' => '认购奖励', '4' => '签约奖励'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 二维数组排序
     * $arrays 需要排的数组
     * $sort_key 排序的数组键名
     */
    public static function my_sort($arrays, $sort_key, $sort_order = SORT_ASC, $sort_type = SORT_NUMERIC )
    {
        if (is_array($arrays)) {
            foreach ($arrays as $array) {
                if (is_array($array)) {
                    $key_arrays[] = $array[$sort_key];
                } else {
                    return false;
                }
            }
        } else {
            return false;
        }
        array_multisort($key_arrays, $sort_order, $sort_type, $arrays);
        return $arrays;
    }

    /**
     * 2015-10-27 吴建阳
     * 获取楼盘装修情况
     * 调用路径：house/index_edit
     */
    public static function dress($index = 0)
    {
        $model = ['1' => '毛坯', '2' =>' 毛坯+精装', '3' => '精装', '4' => '简装'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-10-27 吴建阳
     * 获取楼盘销售情况
     * 调用路径：house/index,house/index_edit
     */
    public static function saleStatus($index = 0)
    {
        $model = ['0' => '未知', '1' => '在售', '2' => '待售', '3' => '售完'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-19-29 吴建阳
     * 价格选择
     */
    public static function priceSelect($index)
    {
        $model = array('1' => '起价', '2' => '区间', '3' => '均价', '4' => '待定');
        return $model[$index];
    }

    /**
     * 2015-11-19 吴建阳
     * 获取楼盘特色
     */
    public static function getTrait($trait, $start_tag, $end_tag)
    {
        if ($trait && $start_tag && $end_tag) {
            $trait_arr = explode(',', substr($trait,0,strlen($trait)-1));
            $str = '';
            foreach ($trait_arr as $key => $val) {
                $str .= $start_tag . $val . $end_tag;
            }
            return $str;
        }
        return false;
    }
    
    /**
     * 2015-10-30 吴建阳
     * 获取价格
     * 调用路径：house/unit
     */
    public static function getMoney($amount, $unit_price)
    {
        $result   = array();
        $arr      = unserialize($amount);
        $arr_info = explode(':', $arr);

        if ($arr_info['1'] == '4') {
            $result['title'] = '价格';
            $result['money'] = '待定';
            $result['unit']  = '';
        } else {
            if ($arr_info['2'] == '2') {
                $amounts2 = explode('-',$arr_info['1']);
                $result['title'] = '区间';
                $result['money'] = $amounts2['0'].'-'.$amounts2['1'];

                if ($unit_price == 1) {
                    $result['unit'] = '万元/套';
                } else {
                    $result['unit'] = '元/㎡';
                }
            } else if ($arr_info['2'] == '5') {
                $result['title'] = $arr_info['0'];
                $result['money'] = $arr_info['1'];

                if ($unit_price == 1) {
                    $result['unit'] = '万元/套';
                } else {
                    $result['unit'] = '元/㎡';
                }
            } else {
                $result['title'] = $arr_info['0'];
                $result['money'] = $arr_info['1'];

                if ($unit_price == 1) {
                    $result['unit'] = '万元/套';
                } else {
                    $result['unit'] = '元/㎡';
                }
            }
        }

        $result['price'] = $result['title'] . '：' . $result['money'] . $result['unit'];
        return $result;
    }

    /**
     * 2015-10-30 吴建阳
     * 自动生成文件名称
     * 调用路径：houseController,hoComm,
     */
    public static function random_filename()
    {
        $seedstr = explode(" ", microtime(), 5);
        $seed    = $seedstr[0] * 10000;
        srand($seed);
        $random  = rand(1000,10000);

        return date("YmdHis", time()) . $random;
    }

    /**
     * 2015-11-6 吴建阳
     * 上传图片
     * 调用路径：houseController,
     */
    public static function createImg($path, $file)
    {
        // Array ( [name] => 1.png [type] => image/png [tmp_name] => F:\wamp\tmp\phpF785.tmp [error] => 0 [size] => 9805 )
        if ($file['error'] === 0) {
            if ($file['type'] != 'image/jpeg' && $file['type'] != 'image/gif' && $file['type'] != 'image/png' && $file['type'] != 'image/bmp' && $file['type'] != 'image/pjpeg' && $file['type'] != 'image/x-png') {
                $res = "文件类型出错";
                echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
                echo "<script type='text/javascript'>alert('{$res}');</script>";
                echo '<script>history.go(-1);</script>';
                exit;
            }
            if ($file['size'] > '2097152') {
                $res = "上传文件不能超过2M";
                echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
                echo "<script type='text/javascript'>alert('{$res}');</script>";
                echo '<script>history.go(-1);</script>';
                exit;
            }

            $dir_name = dirname(\Yii::$app->BasePath).'/images/'.$path;
            // 文件夹不存在的话创建文件夹
            if (!file_exists($dir_name)) {
                mkdir("$dir_name", 0777,true);
            }

            $type_arr  = explode(".", $file['name']); // Array ( [0] => '户型图' [1] => png )
            $name      = HoComm::random_filename(); 
            $file_name = $name.'.'.$type_arr['1'];    // 201510300426568629.png
            move_uploaded_file($file['tmp_name'],$dir_name.$file_name);
        }
        return \Yii::$app->params['imagesUrl'].'/'.$path.$file_name;
    }

    /**
     * 2015-11-6 吴建阳
     * 上传视频
     */
    public static function createVideo($path, $file, $house_id)
    {
        // Array ( [name] => 1.png [type] => image/png [tmp_name] => F:\wamp\tmp\phpF785.tmp [error] => 0 [size] => 9805 )
        if ($file['error'] === 0) {
            $file_arr = $file; 
            $dir_name = dirname(\Yii::$app->BasePath).'/images/'.$path;
            // 文件夹不存在的话创建文件夹
            if (!file_exists($dir_name)) {
                mkdir("$dir_name", 0777,true);
            }

            $type_arr  = explode(".", $file_arr['name']); // Array ( [0] => '户型图' [1] => png )
            $name      = 'video_' . $house_id; 
            $file_name = $name.'.'.$type_arr['1'];        // 201510300426568629.png
            move_uploaded_file($file_arr['tmp_name'],$dir_name.$file_name);
        }
        return \Yii::$app->params['imagesUrl'].'/'.$path.$file_name;
    }

    /**
     * 2015-11-21 吴建阳
     * 移动编辑器上传的图片到根目录的images文件下
     */
    public static function move_ueditor_image($content)
    {
        // 利用正则表达式得到图片链接
        $reg_tag = '/<img.*?\"([^\"]*(jpg|bmp|jpeg|gif|png)).*?>/';  
        $ret     = preg_match_all($reg_tag, $content, $match_result);
        // 循环图片链接复制到根目录的images文件下并删除原来的文件
        if ($match_result[1]) {
            foreach ($match_result[1] as $file) {
                $dir_name = dirname(\Yii::$app->BasePath).'/images/ueditor';
                // 文件夹不存在的话创建文件夹
                if (!file_exists($dir_name)) {
                    mkdir("$dir_name", 0777,true);
                }
                // $file 的值 /ueditor/php/upload/image/ueditor/1448024002610421.jpg
                $type_arr  = explode('ueditor', $file); // ['0' => '/', '1' => '/php/upload/image/','2' => '/1448024002610421.jpg']
                if (count($type_arr) == 3) {
                    $file_name = $type_arr['2'];            // /1448024002610421.jpg

                    copy(\Yii::$app->BasePath.'/web'.$file,$dir_name.$file_name);
                    //unlink(\Yii::$app->BasePath.'/web'.$file);
                }
            }
        }
    }

    /**
     * 2015-11-6 吴建阳
     * 上架下架
     * 调用路径：house/index,house/unit.house/info
     */
    public static function getStatus($index = 0)
    {
        $model = ['1' => '上架', '2' => '下架'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-26 吴建阳
     * 上架下架
     */
    public static function getInfoStatus($index = 0)
    {
        $model = ['1' => '发布中', '2' => '未发布'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-6 吴建阳
     * 锁定正常
     * 调用路径：customer/manager,
     */
    public static function getUserStatus($index = 0)
    {
        $model = ['1' => '正常', '2' => '锁定', '3' => '待审核', '4' => '审核不通过'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-20 吴建阳
     * 置业顾问状态
     */
    public static function getConsultantStatus($index = 0)
    {
        $model = ['1' => '正常', '2' => '锁定'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }
    
    /** 
     * 2015-11-7 吴建阳
     * 用户类别
     * 调用路径：customer/broker,
     */
    public static function getUserType($index = 0)
    {
        $model = [
            '1' => '项目员工', '2' => '老业主', '3' => '兄弟项目', '4' => '社会经纪人', 
            '5' => '案场经理', '6' => '案场销管', '7' => '置业顾问', '10' => '后台管理员'
        ];

        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-6 吴建阳
     * 启用 停用
     * 调用路径：house/message,
     */
    public static function getOpenStatus($index = 0)
    {
        $model = ['1' => '启用', '2' => '停用'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-6 吴建阳
     * 待发放 已发放
     */
    public static function getExchangeStatus($index = 0)
    {
        $model = ['1' => '待发放', '2' => '已发放', '3' => '不发放'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-7 吴建阳
     * 性别
     * 调用路径：customer/index
     */
    public static function getSex($index = 0)
    {
        $model = ['1' => '男', '2' => '女', '3' => '未知'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 2015-11-7 吴建阳
     * 性别
     * 调用路径：customer/index
     */
    public static function getMarried($index = 0)
    {
        $model = ['1' => '是', '2' => '否', '3' => '未知'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }
    
    /**
     * 2015-11-10 吴建阳
     * 获取奖励类型
     * 调用路径：sale/reward,sale/confirm_reward、contract_reward、sub_reward,
     */
    public static function getRewardType($index = 0)
    {
        $model = ['1' => '到访奖励', '2' => '认筹奖励', '3' => '认购奖励', '4' => '签约奖励'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }
    
    /**
     * 2015-11-10 吴建阳
     * 获取奖励状态
     * 调用路径：sale/reward, 
     */
    public static function getRewardStatus($index = 0)
    {
        $model = ['1' => '审批通过', '2' => '审批失败', '3' => '待审批', '10' => '发放成功'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }

    /**
     * 获取图片
     */
    public static function getImages()
    {
        return Yii::$app->request->basePath;
    }

    /**
     * 截取字符串
     */
    public static function cut_str($sourcestr,$cutlength)  
    {  
        $returnstr='';  
        $i=0;  
        $n=0;  
        $str_length=strlen($sourcestr);//字符串的字节数  
        while (($n<$cutlength) and ($i<=$str_length))  
        {  
        $temp_str=substr($sourcestr,$i,1);  
        $ascnum=Ord($temp_str);//得到字符串中第$i位字符的ascii码  
        if ($ascnum>=224) //如果ASCII位高与224，  
        {  
        $returnstr=$returnstr.substr($sourcestr,$i,3); 
        //根据UTF-8编码规范，将3个连续的字符计为单个字符  
        $i=$i+3; //实际Byte计为3  
        $n++; //字串长度计1  
        }  
        elseif ($ascnum>=192) //如果ASCII位高与192，  
        {  
        $returnstr=$returnstr.substr($sourcestr,$i,2);
         //根据UTF-8编码规范，将2个连续的字符计为单个字符  
        $i=$i+2; //实际Byte计为2  
        $n++; //字串长度计1  
        }  
        elseif ($ascnum>=65 && $ascnum<=90) 
        //如果是大写字母，  
        {  
        $returnstr=$returnstr.substr($sourcestr,$i,1);  
        $i=$i+1; //实际的Byte数仍计1个  
        $n++; //但考虑整体美观，大写字母计成一个高位字符  
        }  
        else //其他情况下，包括小写字母和半角标点符号，  
        {  
        $returnstr=$returnstr.substr($sourcestr,$i,1);  
        $i=$i+1; //实际的Byte数计1个  
        $n=$n+0.5; //小写字母和半角标点等与半个高位字符宽…  
        }  
        }  
        if ($str_length>$cutlength){  
        $returnstr = $returnstr;
        //超过长度时在尾处加上省略号  
        }  
        return $returnstr;  
    }

    /**
     * 城市站点
     */
    public static function getCity()
    {
        return array(
            '1101'=>'杭州',
            '1001'=>'南京',
            '0601'=>'沈阳',
            '1601'=>'郑州',
            '09'=>'上海',
            '22'=>'重庆',
            '01'=>'北京',
            '02'=>'天津',
            '1903'=>'深圳',
            '1901'=>'广州',
            '1701'=>'武汉',
            '1401'=>'南昌',
            '0401'=>'太原',
            '2401'=>'贵阳',
            '2301'=>'成都',
            '1301'=>'福州',
            '1201'=>'合肥',
            '1501'=>'济南',
            '0301'=>'石家庄',
            '2701'=>'西安',
            '2501'=>'昆明',
            '2001'=>'南宁',
            '2101'=>'海口',
            '1801'=>'长沙',
        
            '1005'=>'苏州',
            '1102'=>'宁波',
            '1103'=>'温州',
            '1107'=>'金华',
            '1110'=>'台州',
            '1106'=>'绍兴',
            '1105'=>'湖州',
            '1111'=>'丽水',
            '1104'=>'嘉兴',
            '1108'=>'衢州',
            '1002'=>'无锡',
            '1502'=>'青岛',
            '1302'=>'厦门',
            
            '1004'=>'常州',
            '1008'=>'淮安',
            '1007'=>'连云港',
            '1205'=>'马鞍山',
            '1006'=>'南通',
            '1012'=>'泰州',
            '1013'=>'宿迁',
            '1003'=>'徐州',
            '1009'=>'盐城',
            '1010'=>'扬州',
            '1011'=>'镇江',
            
        );
    }

    /**
     * 2015-11-29 吴建阳
     * 获取价格等级
     */
    public static function getPrice($index = 0)
    {
        $model = ['1' => '0-7999', '2' => '8000-9999', '3' => '10000-14999', '4' => '15000-19999', '5' => '20000-29999', '6' => '30000-39999'];

        if ($index) {
            return $model[$index];
        }
        return $model;
    }
    
    /**
     * 2015-11-30 吴建阳
     * 热门楼盘 特价楼盘
     */
    public static function getHotSpecial($index = 0)
    {
        $model = ['1' => '热门楼盘', '2' => '特价楼盘'];
        if ($index) {
            return $model[$index];
        }
        return $model;
    }
}
?>